<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/8
  Time: 20:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html>
<head>
  <title>后台管理系统——留言管理</title>
  <%@ include file="../../layout/import.jsp"%>
  <script type="text/javascript">
    function delNote(noteid) {
      if(confirm("确定删除吗？删除后不可恢复！")){
        $.ajax({
          url: "/admin/delNote.do",
          data: {id:bookid},
          method: "POST",
          dataType: "json",
          error: function () {
            alert("表单提交出错，请稍后再试");
          },
          success: function(response) {
            if(response.code == 0) {
              alert("删除成功");
              window.location.href = "/admin/note.do";

            }
            else {
              alert(response.description);
            }
          }
        });
      }
    }
  </script>
</head>
<body>
<%@ include file="nav.jsp"%>

<div class="container" style="min-height: 72%">
  <div class="col-sm-12">
    <table class="table table-hover">
      <tr>
        <th>留言人ID</th><th>主题</th><th>留言日期</th><th>处理人ID</th><th>处理日期</th><th>操作</th>
      </tr>

      <c:forEach var="note" items="${noteList}">
        <tr>
          <td>${note.userid}</td>
          <td>${note.subject}</td>
          <td>${note.date1}</td>
          <td>${note.employeeid}</td>
          <td>${note.date2}</td>
          <td>
            <a href="/admin/noteReply.do?id=${note.id}">处理</a>
            <a onclick="delNote(${note.id})">删除</a>
          </td>
        </tr>
      </c:forEach>

    </table>

    <nav>
      <ul class="pagination">
        <!--
                <li <c:if test="${thisPage eq 1}">class="disabled"</c:if> >
                    <a href="/admin/book.do?page=${thisPage - 1}" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                -->
        <c:forEach var="page" begin="1" end="${totalPage}" step="1" >
          <li <c:if test="${thisPage eq page}">class="active"</c:if> ><a href="/admin/note.do?page=${page}" > ${page}</a></li>
        </c:forEach>
        <!--
                <li <c:if test="${thisPage eq totalPage}">class="disabled"</c:if>>
                    <a href="/admin/book.do?page=${thisPage + 1}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
                -->
      </ul>
    </nav>

  </div>

</div>


<%@ include file="../footer.jsp"%>
</body>
</html>
